FROM golang:1.22.8-alpine3.20 AS goBuilder
USER root
WORKDIR /arlog
COPY . /arlog/

RUN  CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-s -w --extldflags "-static -fpic"'

FROM alpine:3.20 AS runtime
ENV LANG=C.UTF-8
ENV TZ=Asia/Shanghai
WORKDIR /
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
#    && apk add --no-cache vim iproute2 bash tini curl  tzdata \
#    && rm -rf /var/cache/apk/*
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && apk add  tzdata&& rm -rf /var/cache/apk/*
USER root
COPY --from=goBuilder /arlog/arlog /
COPY config.json  /
#CMD tini -g -- /arlog
CMD /arlog

# 打包命令  docker-slim build  --dockerfile deploy/Dockerfile --continue-after=all  --tag cooting/arlog.slim:0.0.4 .
# 打包命令 docker build  -t  cooting/arlog.slim:1.0 -f deploy/Dockerfile .
# 运行命令 docker rm -f arlog
# 运行命令 docker restart   arlog
# 运行命令 docker run -d --name arlog  -p 8080:80 cooting/arlog.slim:1.0